<head>
<meta name="layout" content="main" />
<title>List an auction</title>
</head>

<body>
	<div class="content">
		<h1>List a new auction</h1>
		<g:if test="${flash.message}">
			<div class="message">
				${flash.message}
			</div>
		</g:if>
		<g:hasErrors>
			<div class="errors">
				<g:renderErrors bean="${auctionInstance}" as="list" />
			</div>
		</g:hasErrors>

		<g:form action="save">
			<fieldset class="form">


				<div class="fieldcontain ${hasErrors(bean: auctionInstance, field: 'auctionTitle', 'error')} required">
					<label for="auctionTitle">  
						Auction Title: 
						<span class="required-indicator">*</span>
					</label>
					<g:textField name="auctionTitle" id="auctionTitle" required="" value="${auctionInstance?.auctionTitle}" />
				</div>

				<div class="fieldcontain ${hasErrors(bean: auctionInstance, field: 'endTime', 'error')} required">
					<label for="endTime">
						End Time:
						<span class="required-indicator">*</span>
					</label>
					<joda:dateTimePicker name="endTime" id="endTime" required="" value="${auctionInstance.endTime}" />
				</div>

				<div class="fieldcontain ${hasErrors(bean: auctionInstance, field: 'startBid', 'error')} required">
					<label for="startBid"> 
						Starting bid: 
						<span class="required-indicator">*</span>
					</label>
					<g:field type="number" step="0.01" name="startBid" id="startBid" required="" value="${fieldValue(bean: auctionInstance, field: 'startBid')}" />
				</div>

				<div class="fieldcontain ${hasErrors(bean: auctionInstance, field: 'hiddenMinBid', 'error')} ">
					<label for="hiddenMinBid"> 
						Minimum bid: 
					</label>
					<g:field type="number" step="0.01" name="hiddenMinBid" id="hiddenMinBid" value="${fieldValue(bean: auctionInstance, field: 'hiddenMinBid')}" />
				</div>

				<div class="fieldcontain ${hasErrors(bean: auctionInstance, field: 'name', 'error')} required ">
					<label for="name"> 
						Item name: 
					</label>
					<g:textField name="name" id="name" required="" value="${auctionInstance?.name}" />
				</div>

				<div class="fieldcontain ${hasErrors(bean: auctionInstance, field: 'description', 'error')} ">
					<label for="description">
						Description: 
					</label>
					<g:textArea name="description"id="description" value="${auctionInstance?.description}" />
				</div>
				

				<div class="fieldcontain ${hasErrors(bean: auctionInstance, field: 'category', 'error')} required">
					<label for="category"> 
						Category: 
						<span class="required-indicator">*</span>
					</label>
					<g:select name="category"
						from="${edu.auctionmart.ItemCategory?.values()}"
						keys="${edu.auctionmart.ItemCategory.values()*.name()}"
						required="" value="${auctionInstance?.category?.name()}" />
				</div>

				<div class="fieldcontain ${hasErrors(bean: auctionInstance, field: 'isbn', 'error')} ">
					<label for="isbn">
						ISBN:
					</label>
					<g:textField name="isbn" id="isbn" value="${auctionInstance?.isbn}" />
				</div>

				<div class="fieldcontain ${hasErrors(bean: auctionInstance, field: 'weight', 'error')} ">
					<label for="weight">
						Weight: 
					</label>
					<g:field type="number" step="0.001" name="weight" id="weight" value="${fieldValue(bean: auctionInstance, field: 'weight')}" />
				</div>

				<div class="fieldcontain ${hasErrors(bean: auctionInstance, field: 'dimension', 'error')} ">
					<label for="dimension"> 
						Dimension:
					</label>
					<g:textField name="dimension" id="dimension" value="${auctionInstance?.dimension}" />
				</div>

				<div class="fieldcontain ${hasErrors(bean: auctionInstance, field: 'quantity', 'error')} required">
					<label for="quantity"> 
						Quantity: 
						<span class="required-indicator">*</span>
					</label>
					<g:field type="number" id="quantity" name="quantity" min="1" required="" value="${fieldValue(bean: auctionInstance, field: 'quantity')}" />
				</div>

			</fieldset>

			<div class="buttons">
				<span class="button"> <g:submitButton class="save"
						name="user" value="Create" />
				</span>
			</div>

		</g:form>
	</div>
</body>
